<?php
class Pageley_Domain_Attribute_OneToManyDecorator extends Pageley_Domain_Attribute_MultipleDecorator {
	private $inversePropertyName;
    
    public function __construct($attribute, $inversePropertyName = null) {
        $validators = new Pageley_Util_ArrayMap();
        if(!($attribute instanceof Pageley_Domain_Attribute_Reference)) {
            throw new Pageley_Domain_RuntimeException("Only reference attributes are supported in one-to-many relationships.");
        }
        parent::__construct($attribute, $validators);
        $this->inversePropertyName = $inversePropertyName;
    }
    
    public function isManyToMany() {
        return false;
    }
    
    public function getInversePropertyName() {
        return $this->inversePropertyName;
    }
    
    public function __toString() {
        return $this->getName() . "(one to many)";
    }
}